<!DOCTYPE html>
<html>

<head>
    <title>入库API测试</title>
    <style>
        body {
            font-family: Arial;
            margin: 20px;
        }

        .result {
            margin: 10px 0;
            padding: 10px;
            border: 1px solid #ccc;
        }

        .success {
            background: #d4edda;
        }

        .error {
            background: #f8d7da;
        }
    </style>
</head>

<body>
    <h1>入库API测试</h1>
    <button onclick="testApi()">测试API</button>
    <div id="result"></div>

    <script>
        async function testApi() {
            const resultDiv = document.getElementById('result');
            resultDiv.innerHTML = '<div class="result">测试中...</div>';

            try {
                const response = await fetch('http://localhost:5000/api/Inbound/list?pageIndex=1&pageSize=10');
                const data = await response.json();

                if (data.code === 200) {
                    resultDiv.innerHTML = `
                        <div class="result success">
                            <h3>✅ 成功</h3>
                            <p>总条数: ${data.data.totalCount}</p>
                            <p>当前页数据: ${data.data.pageData.length} 条</p>
                            <p>第一条数据: ${JSON.stringify(data.data.pageData[0])}</p>
                        </div>
                    `;
                } else {
                    resultDiv.innerHTML = `
                        <div class="result error">
                            <h3>❌ 失败</h3>
                            <p>错误: ${data.message}</p>
                        </div>
                    `;
                }
            } catch (error) {
                resultDiv.innerHTML = `
                    <div class="result error">
                        <h3>❌ 网络错误</h3>
                        <p>错误: ${error.message}</p>
                    </div>
                `;
            }
        }
    </script>
</body>

</html>